package space.sakana.edusysback.mapper.cls;

import org.apache.ibatis.annotations.*;
import space.sakana.edusysback.entity.cls.ClsUser;

import java.util.List;

@Mapper
public interface ClsUserMapper {

    @Select("select `id`, `uid`, `cid` from classuser where `id`=#{id};")
    ClsUser selectClsUserById(int id);

    @Select("select `id`, `uid`, `cid` from classuser where `cid`=#{cid};")
    List<ClsUser> selectClsUsersByCid(int cid);

    @Select("select `id`, `uid`, `cid` from classuser where `uid`=#{uid};")
    List<ClsUser> selectClsUsersByUid(int uid);

    @Insert("insert into classuser(`uid`, `cid`) values(#{uid}, #{cid});")
    int insertClsUser(ClsUser clsUser);

    @Update("update classuser set `uid`=#{uid}, `cid`=#{cid} where `id`=#{id};")
    int updateClsUser(ClsUser clsUser);

    @Select("select `id`, `uid`, `cid` from classuser where `uid`=#{uid} and `cid`=#{cid};")
    ClsUser selectClsUsersByUidAndCid(int uid, int cid);

    @Delete("delete from classuser where `uid`=#{uid}")
    int deleteClsUser(int uid);
}
